/**
 * Copyright &copy; 2015-2020 <a href="http://www.easyhis.com/">easyhis</a> All rights reserved.
 */
package com.easy.dfcapi.entity;

import com.easy.common.utils.IdGen;
import com.easy.common.utils.excel.annotation.ExcelField;
import com.easy.core.persistence.BaseEntity;
import com.easy.modules.sys.entity.User;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 店铺表Entity
 * @author waylen chi
 * @version 2018-01-02
 */
public class ApiStore extends BaseEntity<ApiStore> {
	
	private static final long serialVersionUID = 1L;
	private String id;// 商铺UUID
	private Integer storeId;		// 商铺内部ID, 标识字段，主键
	private ApiUser user;		// 店主ID,外键（UserSet）
	private String storeName;		// 商铺名称
	private Integer storeType;		// 商铺类型:1--原料商 2-厂商  3-批发商   4-经销商[注1]
	private Integer storeArea;		// 商铺区域
	private String email;		// 公司邮箱
	private String phone;		// 公司电话
	private Integer organTypeId;		// 外键（机构类型OrganType），默认0
	private String organCode;		// 组织机构代码号或社会信用代码号
	private String legalName;		// 法定代表人姓名
	private String legalIdno;		// 法定代表人身份证号
	private Integer legalIdimg;		// 法定代表人身份证照片ID
	private String legalIdimgUrl;		// 法定代表人身份证照片URL
	private Integer legalArea;		// 外键（法人归属地LegalArea），默认0
	private String legalMobile;		// 法定代表人手机号
	private String agentName;		// 代理人姓名
	private String agentIdno;		// 代理人身份证号
	private String agentMobile;		// 代理人手机号
	private String address;		// 公司地址
	private String scope;		// 经营范围
	private Integer storeAvatar;		// 店招图片
	private String storeAvatarUrl;		// 店招图片
	private Integer storeImg;		// 店面图片
	private String storeImgUrl;		// 店面图片
	private String licenseNo;		// 营业执照号码
	private Integer licenseImg;		// 营业执照图片
	private String licenseImgUrl;		// 营业执照图片URL
	private Integer isRealName;		// 是否实名
	private Integer storeStar;		// 店铺星级 1-5星  10-15钻    20-25 冠等级
	private Integer storeLevel;		// 店铺等级(卖家)1.童品汇 2.潮牌馆 3.品牌馆 4.尾品汇
	private Integer isAudit;		// 是否审核通过0未审核 1已审核 2-暂停
	private Date createTime;		// 注册时间
	private ApiUser createBy;		// 注册人0,为自己注册
	private Date updateTime;		// 更新时间
	private ApiUser updateBy;		// 更新人
	private Integer delFlag;		// 删除标志

	public ApiStore() {
		super();
	}

	public ApiStore(Integer storeId){
		this.storeId = storeId;
	}

	@NotNull(message="商铺内部ID, 标识字段，主键不能为空")
	@ExcelField(title="商铺内部ID, 标识字段，主键", align=2, sort=0)
	@JsonIgnore
	public Integer getStoreId() {
		return storeId;
	}

	public void setStoreId(Integer storeId) {
		this.storeId = storeId;
	}
	
	@ExcelField(title="店主ID,外键（UserSet）", fieldType=User.class, value=".userName", align=2, sort=1)
	public ApiUser getUser() {
		return user;
	}

	public void setUser(ApiUser user) {
		this.user = user;
	}
	
	@ExcelField(title="商铺UUID", align=2, sort=2)
	@JsonIgnore
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ExcelField(title="商铺名称", align=2, sort=3)
	public String getStoreName() {
		return storeName;
	}

	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}
	
	@ExcelField(title="商铺类型:1--原料商 2-厂商  3-批发商   4-经销商[注1]", align=2, sort=4)
	public Integer getStoreType() {
		return storeType;
	}

	public void setStoreType(Integer storeType) {
		this.storeType = storeType;
	}
	
	@ExcelField(title="公司邮箱", align=2, sort=5)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@ExcelField(title="公司电话", align=2, sort=6)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@ExcelField(title="外键（机构类型OrganType），默认0", align=2, sort=7)
	public Integer getOrganTypeId() {
		return organTypeId;
	}

	public void setOrganTypeId(Integer organTypeId) {
		this.organTypeId = organTypeId;
	}
	
	@ExcelField(title="组织机构代码号或社会信用代码号", align=2, sort=8)
	public String getOrganCode() {
		return organCode;
	}

	public void setOrganCode(String organCode) {
		this.organCode = organCode;
	}
	
	@ExcelField(title="法定代表人姓名", align=2, sort=9)
	public String getLegalName() {
		return legalName;
	}

	public void setLegalName(String legalName) {
		this.legalName = legalName;
	}
	
	@ExcelField(title="法定代表人身份证号", align=2, sort=10)
	public String getLegalIdno() {
		return legalIdno;
	}

	public void setLegalIdno(String legalIdno) {
		this.legalIdno = legalIdno;
	}
	
	@ExcelField(title="外键（法人归属地LegalArea），默认0", align=2, sort=11)
	public Integer getLegalArea() {
		return legalArea;
	}

	public void setLegalArea(Integer legalArea) {
		this.legalArea = legalArea;
	}
	
	@ExcelField(title="代理人姓名", align=2, sort=12)
	public String getAgentName() {
		return agentName;
	}

	public void setAgentName(String agentName) {
		this.agentName = agentName;
	}
	
	@ExcelField(title="代理人身份证号", align=2, sort=13)
	public String getAgentIdno() {
		return agentIdno;
	}

	public void setAgentIdno(String agentIdno) {
		this.agentIdno = agentIdno;
	}
	
	@ExcelField(title="公司地址", align=2, sort=14)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	@ExcelField(title="经营范围", align=2, sort=15)
	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}
	
	@ExcelField(title="店招图片", align=2, sort=16)
	public Integer getStoreImg() {
		return storeImg;
	}

	public void setStoreImg(Integer storeImg) {
		this.storeImg = storeImg;
	}
	
	@ExcelField(title="营业执照号码", align=2, sort=17)
	public String getLicenseNo() {
		return licenseNo;
	}

	public void setLicenseNo(String licenseNo) {
		this.licenseNo = licenseNo;
	}
	
	@ExcelField(title="营业执照图片", align=2, sort=18)
	public Integer getLicenseImg() {
		return licenseImg;
	}

	public void setLicenseImg(Integer licenseImg) {
		this.licenseImg = licenseImg;
	}
	
	@ExcelField(title="是否实名", align=2, sort=19)
	public Integer getIsRealName() {
		if(isRealName == null) return 0;
		return isRealName;
	}

	public void setIsRealName(Integer isRealName) {
		this.isRealName = isRealName;
	}
	
	@ExcelField(title="店铺星级 1-5星  10-15钻    20-25 冠等级", align=2, sort=20)
	public Integer getStoreStar() {
		if(storeStar == null) return 1;
		return storeStar;
	}

	public void setStoreStar(Integer storeStar) {
		this.storeStar = storeStar;
	}
	
	@ExcelField(title="店铺等级(卖家)1.童品汇 2.潮牌馆 3.品牌馆 4.尾品汇", align=2, sort=21)
	public Integer getStoreLevel() {
		return storeLevel;
	}

	public void setStoreLevel(Integer storeLevel) {
		this.storeLevel = storeLevel;
	}
	
	@ExcelField(title="是否审核通过0未审核 1已审核 2-暂停", align=2, sort=22)
	public Integer getIsAudit() {
		if(isAudit == null) return 0;
		return isAudit;
	}

	public void setIsAudit(Integer isAudit) {
		this.isAudit = isAudit;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="注册时间", align=2, sort=23)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@ExcelField(title="注册人0,为自己注册", align=2, sort=24)
	public ApiUser getCreateBy() {
		return createBy;
	}

	public void setCreateBy(ApiUser createBy) {
		this.createBy = createBy;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="更新时间", align=2, sort=25)
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@ExcelField(title="更新人", align=2, sort=26)
	public ApiUser getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(ApiUser updateBy) {
		this.updateBy = updateBy;
	}
	
	@ExcelField(title="删除标志", dictType="del_flag", align=2, sort=27)
	public Integer getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(Integer delFlag) {
		this.delFlag = delFlag;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(){
		this.updateTime = new Date();
	}
	/**
	 * 插入之前执行方法，需要手动调用
	 */
	public void preInsert(Date now){
		this.id = IdGen.uuid();

		this.updateTime = now;
		this.createTime = this.updateTime;
	}

	/**
	 * 更新之前执行方法，需要手动调用
	 */
	public void preUpdate(Date now){
		this.updateTime = now;
	}

	public Integer getStoreArea() {
		return storeArea;
	}

	public void setStoreArea(Integer storeArea) {
		this.storeArea = storeArea;
	}

	public Integer getLegalIdimg() {
		return legalIdimg;
	}

	public void setLegalIdimg(Integer legalIdimg) {
		this.legalIdimg = legalIdimg;
	}

	public String getLegalMobile() {
		return legalMobile;
	}

	public void setLegalMobile(String legalMobile) {
		this.legalMobile = legalMobile;
	}

	public String getAgentMobile() {
		return agentMobile;
	}

	public void setAgentMobile(String agentMobile) {
		this.agentMobile = agentMobile;
	}

	public Integer getStoreAvatar() {
		return storeAvatar;
	}

	public void setStoreAvatar(Integer storeAvatar) {
		this.storeAvatar = storeAvatar;
	}

	public String getLegalIdimgUrl() {
		return legalIdimgUrl;
	}

	public void setLegalIdimgUrl(String legalIdimgUrl) {
		this.legalIdimgUrl = legalIdimgUrl;
	}

	public String getStoreAvatarUrl() {
		return storeAvatarUrl;
	}

	public void setStoreAvatarUrl(String storeAvatarUrl) {
		this.storeAvatarUrl = storeAvatarUrl;
	}

	public String getStoreImgUrl() {
		return storeImgUrl;
	}

	public void setStoreImgUrl(String storeImgUrl) {
		this.storeImgUrl = storeImgUrl;
	}

	public String getLicenseImgUrl() {
		return licenseImgUrl;
	}

	public void setLicenseImgUrl(String licenseImgUrl) {
		this.licenseImgUrl = licenseImgUrl;
	}
}